import { createBrowserRouter, Navigate } from 'react-router-dom'
import Home from '@/pages/home'
import Intro from '@/pages/intro'
import Industry from '@/pages/industry'
import SystemCert from '@/pages/systemCert'
import CooperationCase from '@/pages/cooperationCase'
import News from '@/pages/news/index'
import NewsDetail from '@/pages/news/detail'
import Contact from '@/pages/contact'
import Entry from '@/pages/entry'
 
// 全局路由
export const globalRouters = createBrowserRouter([
    // 如果URL没有"#路由"，跳转Home页面
    {
        path: '/',
        element: (
            <Entry />
        ),
        children : [
            // 精确匹配"/home"，跳转Home页面
            {
                path: '/',
                element: <Home />,
            },
            {
                path: '/home',
                element: <Home />,
            },
            {
                path: '/intro',
                element: <Intro />,
            },
            {
                path: '/industry',
                element: <Industry />,
            },
            {
                path: '/systemCert',
                element: <SystemCert />,
            },
            {
                path: '/cooperationCase',
                element: <CooperationCase />,
            },
            {
                path: '/news',
                element: <News />,
            },
            {
                path: '/contact',
                element: <Contact />,
            },
        ]
    },
    // 未匹配,跳转Home页面
    {
        path: '*',
        element: <Navigate to="/home" />,
    },
])